﻿
using badmati.Log.Models;
using badmati.Log.Mapping;
using badmati.Log.Repository;
using Dapper;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace badmati.Log
{

    public class BLogManager
    {
        private DbManager dbManager;

        public BLogManager()
        {
            dbManager = new DbManager();
            //添加model映射
            SqlMapper.SetTypeMap(typeof(LoginRecord), new ColumnAttributeTypeMapper<LoginRecord>());
            SqlMapper.SetTypeMap(typeof(FuncOperationRecord), new ColumnAttributeTypeMapper<FuncOperationRecord>());
            SqlMapper.SetTypeMap(typeof(DiagnosisRecord), new ColumnAttributeTypeMapper<DiagnosisRecord>());
        }
        public ILog GetLogger()
        {
            ILog log = LogManager.GetLogger("badmati");
            return log;
        }
        public LoginRecordRepository GetLoginRecordRepository()
        {
            return new LoginRecordRepository(dbManager.DbConnection);
        }
        public FunctionRecordRepository GetFunctionRecordRepository()
        {
            return new FunctionRecordRepository(dbManager.DbConnection);
        }
        public DiagnosisRecordRepository GetDiagnosisRecordRepository()
        {
            return new DiagnosisRecordRepository(dbManager.DbConnection);
        }
    }
}
